#include <iostream>
#include <gtest/gtest.h>
int add(int a, int b) {
	return a + b;
}
TEST(testCase1, should_3_when_given_2_and_1) {
	EXPECT_EQ(add(2, 1), 3);

}

TEST(testCase2, should_13_when_given_12_and_1) {
	EXPECT_EQ(add(12, 1), 13);

}

#include "MockUser.h"
#include <gmock/gmock.h>

TEST(testCase3, test) {
	MockUser user;
	//模拟getAge,第一次调用返回200，第二次调用返回300，后续重复调用返回500，最少调用3次
	EXPECT_CALL(user, getAge).
		Times(testing::AtLeast(3)).
		WillOnce(testing::Return(200)).		
		WillOnce(testing::Return(300)).
		WillRepeatedly(testing::Return(500));
	std::cout << user.getAge() << std::endl;
	std::cout << user.getAge() << std::endl;
	std::cout << user.getAge() << std::endl;
	std::cout << user.getAge() << std::endl;
	std::cout << user.getAge() << std::endl;
	std::cout << user.getAge() << std::endl;
}

int main(int argc, char** argv) {
	testing::InitGoogleTest(&argc,argv);
	return RUN_ALL_TESTS();
}